package org.magento.customer;

import static org.testng.AssertJUnit.assertTrue;
import java.util.concurrent.TimeUnit;

import org.magenta.data.NewCustomerData;
import org.magento.basic.basicTestCase;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;


public class createNewCustomerFE  extends basicTestCase  {
	public WebDriver driver;
	public String baseUrl = "http://denis.magento.batavi.org";


	@BeforeTest
public void setUp() throws Exception {
		driver = new  FirefoxDriver();
		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		}
	
@Test
public void createNewCustomer () throws Exception {
	NewCustomerData newCustomer = new NewCustomerData("firstname", "lastname", "dzentesting@gmail.com", "test12345", "test12345");
		gotoCreateNewCustomerPage();
		fillCreateNewCustomerForm(newCustomer);
		submitNewCustomer();
		verifyNewCustomerCreation(newCustomer);
		}

public void verifyNewCustomerCreation(NewCustomerData newCustomer) {
	assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("Thank you for registering with Main Website Store"));
	assertTrue(driver.getPageSource().contains(newCustomer.email));
}

@AfterTest
public void tearDown() throws  Exception {
	
		}
	}

